(Untitled)

DivX codec version 4.0

The DivX™ codec v4.0 is the latest and greatest release of DivX – the best compression technology for high-resolution movies. It features:

  • Complete decoding support for files encoded in DivX 3.11 and 4.0 beta 47-50. On properly configured systems, the decoder is faster than all previous DivXdecoders
  • Fast, improved post-processing implementation
  • A completely reengineered encoder, optimized for all modern x86 processors, with two-pass variable bit-rate encoding and more.


Performance issues

There are several things you can do to ensure your system is prepared to play DivX content with optimum performance.

Windows Media Player uses one of two methods to decode DivX™: the “Video for Windows codec” or the “DivX decoder filter.” For speeds up to two times faster, make sure Windows Media Player uses the DivX™ decoder filter for playback. The DivX decoder filter should have been installed with the codec. To check, playback a DivX file, right-click on the image, select “Properties” and choose the “Advanced” tab. If the filter is installed, you will see it in the list.

If it is not there, you can do the following.

  • Set your graphics acceleration to maximum in the display properties.

  • Ensure that you’re not running a video capture or TV tuner application.

  • Try switching the display depth. The filter usually does not work in 8-bit modes.

  • Upgrade drivers for your video card.

If nothing helps, it is recommended that you switch to 16-bit display depth, because it is usually fastest with VfW codec.


Post-processing

The post-processing algorithm consists of the deblocking and the deringing filters. Post-processing is a CPU-intensive process, which sometimes takes longer than decoding. You may not want to post-process, especially if you prefer the un-post-processed image, or if your PC is not powerful enough. To cater to users’ post-processing preferences, 6 different levels of post-processing have been defined. At the minimum (level 0), no post-processing algorithm is used; at the maximum (level 6), every clever algorithm is tried to enhance the appearance of your frames.

The human eye is less sensitive to the chrominance components of the video signal and more sensitive to the luminance components. For this reason, only the luminance plane is processed at lower post-processing levels, while higher levels activate the same algorithms on the chrominance planes. The post-processing algorithms used are activated in the following order: deblocking on luminance planes, deblocking on chrominance planes, deringing.

You can adjust postprocessing level in two ways. Either use the slider in configuration dialog of DivX DirectShow filter ( which can be accessed from Windows Media Player window while playing ) or in configuration dialog of encoder DLL. Both sliders do exactly the same thing.


Deblocking

This filter operates along the 8x8 block edges, on both the luminance and chrominance color planes. It helps to reduce the blocking artifacts caused by the DCT spatial compression algorithm used by the codec.

Blockiness is the most noticeable artifact, so this algorithm is the first one to be applied. The deblocking can be applied on the horizontal and vertical edges (horizontal and vertical deblocking, respectively). The two deblocking methods are applied horizontal first, then vertical. Therefore, at the post-processing level 1, only the horizontal deblocking filter is used (on the luminance blocks), at level 2 both the horizontal and the vertical deblocking filters are used.

No deblocking:

Deblocking:


Deringing

The deringing filter is used to eliminate noise near sharp edges caused by the quantization process ( so-called Gibbs effect ). This noise is more noticeable in animations, where there are higher frequency coefficients. The deringing on the luminance plane is activated at post-processing level 5 or higher; the deringing on the chrominance planes is activated at post-processing level 6. Due to high CPU requirements and relatively low impact of the filter, it is only turned on for Pentium-III or newer processors.

No deringing:

Deringing:


Different bitrate modes

DivX 4.0 encoder allows to select among three possible modes.

  1. Constant bitrate mode. Encoder will aim at making the average bitrate of movie close to specified value, retaining more data for low-motion scenes and losing more information in fast-motion ones.

  2. 1-pass variable bitrate mode. Encoder will code everything with the same absolute quality, without respect to amount of motion.

  3. 2-pass variable bitrate mode. Encoder will try to make the subjective quality of the stream constant, at the same time making the complete stream size close to the number your specified. When you want to encode 2-hour show and be sure that it fits to 650 Mb CD, this choice is for you.


Constant bitrate mode

Constant bitrate mode is aimed at producing output with a fixed average bitrate. When this mode is turned on, the encoder automatically adjusts level of compression for your media as it is compressed. Long high-motion scenes will cause it to increase compression level; and likewise, scenes with low or no motion will be compressed less. There are several parameters that control compression in this mode.
Bitrate

Bitrate sets the target bitrate of the encoding. The rate control will try to react to the scenes of the sequence and try to achieve the rate specified. Note that it is a desired target, but 100 percent accuracy is not guaranteed all the time.
Please note that the unit is kilo *bits* per second. You need to divide it by 8 to get kBytes per second.
Also note that it is for the bitrate of video part only. The audio is not included.

Example: 720MBytes / 2hours = 800 kbps.

MAX and MIN Quantizers

Quantizer is one most important parameters in video coding. Without going into detail, quantizer controls how fine the encoder codes the video sequence. The rule of thumb is: for the same frame, smaller quantizer ==> better quality, higher bit consumption.
larger quantizer ==> lower bit consumption, inferior quality.

Adjusting the quantizer operates the rate control. Balance the quality of video with bit consumption can be quite the art form.

Note: You can set both MAX and MIN quantizer to be the same to get the "constant quality,” but that leaves no room for all the rate control functions to operate and turn the bitrate.
Now all the other RC thing - Averaging, Reaction, and Up/Down ratio ...

These are for more advanced users. The default setting gives near-optimum results in most scenarios.

For the adventurous souls,
Averaging - controls how fast the RC forgets the rate history. larger value usually results in more accurate overall rates. But it should not be too large compared to the length of the sequence.

Reaction - controls how fast the RC adopts to recent scenes. Larger value usually results in better high motion scenes and worse low motion scenes.

Down/Up ratio - controls the relative sentivity in reaction to high or low motion scenes. Larger value usually results in better high motion scenes, but larger bit consumption.

All these parameters are inter-correlated. The effect from their setting is approximate and often depends on the settings of the other parameters.


1-pass vbr

1-pass quality-based mode

In this mode, all frames receive the same amount of compression, without regard to their complexity. While it is not the best choice for making archives, it is a good idea to use this mode when preparing content for future editing. It guarantees the preservation of quality in all frames.


2-pass variable bitrate mode

In this mode, the encoder will try to make the subjective quality of the stream constant, and simultaneously make the complete stream size close to the number you specified. If you want to encode a 2-hour show that it fits on a 650 Mb CD, this choice is for you.
Operation in this mode is most complicated, because it requires the source to be processed twice. 2-pass encoding is independent from any application you may use for encoding. It can be used with any program. However, it needs to use an external file on your hard disk to temporarily store encoding data.

To use this mode, open the encoder config dialog and select “Variable bitrate mode” --> “2-pass, first pass.” The encoder analyzes the source during first pass, creating a log file with information about the frames. "Log file" field in encoder configuration dialog must point to the place where encoder has write permissions (you'll need about 250 kb of disk space for each 1 minute of video).

Start encoding process. Encoding program will create an unplayable AVI file and write the log file. When it's finished, return to the config dialog and select “variable bitrate mode” --> “2-pass, second pass.” Start encoding (source must be exactly the same!). At this time, the encoder will read the log file and write a real VBR AVI.

It is best to use the same “performance/quality” setting for both passes, but it is not an absolute requirement. Don’t use “fastest” for either of two passes.

You can also use different values for “bitrate” in first and second passes, but if they differ much (e.g. 200 vs. 900 kbps), the encoder may have problems achieving the file size you want.


Frame dropping

This parameter is available only in 2-pass variable bitrate mode. It allows the encoder to selectively drop passed frames when it believes they do not contain enough significant information. It is helpful when you want to produce a stream with the lowest possible bitrate, but retain acceptable visual quality. In this case, the encoder will drop more frames in scenes with low motion or no motion at all, and keep them in the fast-motion scenes.

The default setting for “Frame dropping” is 0 because usually there is no need to drop frames.


Deinterlacing

Video streams captured from TV or VCR in high resolutions usually contain "interlacing" artifacts. For example, maximum allowed height for NTSC is 480 lines at 30 frames/second. However, the actual television signal has a frequency of 60Hz and vertical resolution of only 320 lines. Thus, captured streams will contain interleaving lines from two subsequent "fields," which have different positions in time.

Look at the screenshot:

This is a good example of 'interlaced' picture. Here is the same picture after deinterlacing:

The good thing about deinterlacing inside the encoder is that it's done almost for free. The most popular video processing applications include deinterlacing filters, but they can eat up to 15-20 percent or more of the time. In contrast, deinterlacing in the encoder takes no more than 1-2 percent of CPU power.

The default setting for "Deinterlacing" is "off."

Do not use deinterlacing inside the codec if input stream was resized or otherwise preprocessed in some way. If you want to do complex filtering of interlaced stream. always use external deinterlacing and put deinterlacing filter first in the pipeline.


Other options

‹Maximum key frame interval› is the maximum interval between the places to which you can seek in resulting file. The DivX encoder will insert a key frame every time it detects a scene change. However, long intervals between scene changes are possible, and when they occur, the encoder automatically inserts keyframes with specified frequencies.

The default value is 300, which corresponds with one keyframe at least every 10 seconds in a 30 fps stream.

‹Max CPU› usage limits the amount of CPU time used by the encoder, to give some time to other tasks or to reduce processor temperature, for example. By default, it is turned off.

The ‹Performance/quality› switch lets you decide whether you want the encoder to be done fast or to crunch everything to the smallest possible size. “Fastest” mode is optimized for real-time video capture. This choice is recommended for use with “1-pass quality-based” bitrate mode. ”Slowest” mode with “2-pass variable bitrate mode” is good for making video archives. The default value is “slowest”.


Codec development team

Decoder:

Decoder core: Andrea Graziani
YUV -> RGB conversions: Andrea Graziani, John Funnell
DivX 3.11 compatibility: Eugene Kuznetsov
Postprocessing: Andrea Graziani, John Funnell, Eugene Kuznetsov
Various improvements and bugfixing: Damien Chavarria, James Leiterman

Encoder:

Core, MMX/SSE optimizations: Eugene Kuznetsov
Rate control, Video for Windows driver, bugfixes and cleanups: Adam Li
MMX interpolation module: John Funnell

Management & QA:

Jerome Rota
Jordan Greenhall
Darrius Thompson
Jennifer Mendel


Copyrights

DivX video codec 4.0 is © DivXNetworks, Inc. ( http://www.divxnetworks.com ), 2001.

MMX iDCT and fDCT implementations are © Intel Corp., 1998-2000.


DivX decoder

DivX 4.0 encoder ‹encore› is a very efficient MPEG-4 compatible video encoder. It is covered in more detail in further topics.


DivX encoder

DivX 4.0 decoder ‹decore› is the fastest DivX decoder out there. It is covered in more detail in further topics.